package me.frank.webflux.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import reactor.core.publisher.Mono;

import java.time.Duration;

/**
 * @author Frank Wang
 * @Description:
 * @date 2018/8/15 15:31
 */
@RestController
public class TestController {

    @GetMapping("/hello/{latency}")
    public Mono<String> hello(@PathVariable int latency){
        return Mono.just("Welcome to reactive world ~")
                .delayElement(Duration.ofMillis(latency));
    }

}
